Component({
  data: {
    active: 0, //底部按钮高亮下标
    tabBar: [{
        "iconPath": "/image/home.png",
        "selectedIconPath": "/image/action.jpg",
        "text": "首页"
      },
      {
        "iconPath": "/image/meal.png",
        "selectedIconPath": "/image/action.jpg",
        "text": "点餐"
      },
      {
        "iconPath": "/image/order.png",
        "selectedIconPath": "/image/action.jpg",
        "text": "订单"
      },
      {
        "iconPath": "/image/mine.png",
        "selectedIconPath": "/image/action.jpg",
        "text": "我的"
      }
    ]
  },
  methods: {
    switchTab(event) {
      const {
        detail
      } = event;
      this.setData({
        active: detail // 更新激活的 Tabbar 项  
      });
      // 根据 Tabbar 项的 tab 属性值进行页面跳转  
      switch (detail) {
        case 0:
          wx.switchTab({
            url: '/pages/index/index'
          });
          break;
        case 1:
          wx.switchTab({
            url: '/pages/meal/index'
          });
          break;
        case 2:
          wx.switchTab({
            url: '/pages/order/index'
          });
          break;
        case 3:
          wx.switchTab({
            url: '/pages/mine/index'
          });
          break;
        default:
          break;
      }
    },
  }
})